package com.starlink.controller.wechat;

import com.starlink.common.WebResponse;
import com.starlink.common.annotation.WebAccess;
import com.starlink.model.request.CheckInRecordsRequest;
import com.starlink.model.vo.system.WechatCheckInAndPointVO;
import com.starlink.service.CheckInRecordsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * @author zhanghong
 */
@RestController
@RequestMapping("/wechat/CheckInRecords")
@Api(value = "【小程序端】签到记录模块", tags = {"【小程序端】签到记录模块"})
public class WechatCheckInRecordsController {

    @Autowired
    private CheckInRecordsService checkInRecordsService;

    @WebAccess(login = true)
    @ApiOperation("签到信息查询")
    @PostMapping("/getInfo")
    public WebResponse<WechatCheckInAndPointVO> getInfo() {
        return WebResponse.build(checkInRecordsService.getInfo());
    }

    @WebAccess(login = true)
    @ApiOperation("签到")
    @PostMapping("/signIn")
    public WebResponse<Boolean> signIn(@Valid @RequestBody CheckInRecordsRequest request) {
        return WebResponse.build(checkInRecordsService.signIn(request));
    }
}
